﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace StarLabel.label.item
{
    /// <summary>
    /// Copyright 2019  ZhengJi. All Rights Reserved.
    /// 方框标签
    /// </summary>
    public class BoxItem:Item
    {
        public BoxItem(XmlElement el) : base(el)
        {
        }

        /// <summary>
        /// 线条厚度
        /// </summary>
        public string Thickness { get; set; }
        public string X2 { get; set; }
        public string Y2 { get; set; }

        protected override void parseFromXml()
        {
            this.X2 = this.xmlEl.Attributes["X2"]==null?"0": this.xmlEl.Attributes["X2"].Value;
            this.Y2 = this.xmlEl.Attributes["Y2"]==null?"0": this.xmlEl.Attributes["Y2"].Value;
            this.Thickness = this.xmlEl.Attributes["Thickness"]==null?"4": this.xmlEl.Attributes["Thickness"].Value;
            base.parseFromXml();
        }
        public override void DrawLabel(float x, float y, string labelText,string rotation)
        {
            TSCPrint.DrawBox(int.Parse(x.ToString()), int.Parse
                  (y.ToString()), int.Parse(this.X2), int.Parse(this.Y2), this.Thickness);
        }
    }
}
